package io.jft.doll.model.bindModel

import android.databinding.ObservableField
import android.os.CountDownTimer

/**
 * Created by G on 2017/8/15 0015.
 */
class VerifyCodeBind {
    val des = ObservableField<String>("获取验证码")
    val enable = ObservableField<Boolean>(true)

    fun tick() {
        var total = 60
        val timer = object : CountDownTimer(1000L * 60L, 1000L) {
            override fun onFinish() {
                enable.set(true)
                des.set("获取验证码")
            }

            override fun onTick(p0: Long) {
                des.set("$total 秒后重试")
                enable.set(false)
                total--
            }
        }
        timer.start()
    }
}